package Operations;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class Returnbook implements Ioperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("归还图书");
        System.out.println("请输入你想归还的图书名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getSize(); i++) {
            Book books = bookList.Getpos(i);
            if (name.equals(books.getBook_name())) {
                books.setIs_borrowed(false);
                System.out.println("归还成功");
                return;
            }
        }
        System.out.println("书名错误");
    }
}
